package com.strange.mdl.module.mdl.dal.mysql.sutras;

import com.strange.mdl.framework.common.pojo.PageResult;
import com.strange.mdl.framework.mybatis.core.mapper.BaseMapperX;
import com.strange.mdl.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.strange.mdl.module.mdl.controller.admin.sutras.vo.chapters.MdlSutraChaptersPageReqVO;
import com.strange.mdl.module.mdl.dal.dataobject.sutras.MdlSutraChaptersDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 经书章节 Mapper
 *
 * @author 密谛灵总控
 */
@Mapper
public interface MdlSutraChaptersMapper extends BaseMapperX<MdlSutraChaptersDO> {

    default PageResult<MdlSutraChaptersDO> selectPage(MdlSutraChaptersPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MdlSutraChaptersDO>()
                .eqIfPresent(MdlSutraChaptersDO::getSutraId, reqVO.getSutraId())
                .eqIfPresent(MdlSutraChaptersDO::getVolumeId, reqVO.getVolumeId())
                .eqIfPresent(MdlSutraChaptersDO::getChapterNumber, reqVO.getChapterNumber())
                .eqIfPresent(MdlSutraChaptersDO::getChapterTitle, reqVO.getChapterTitle())
                .eqIfPresent(MdlSutraChaptersDO::getContent, reqVO.getContent())
                .eqIfPresent(MdlSutraChaptersDO::getWordCount, reqVO.getWordCount())
                .eqIfPresent(MdlSutraChaptersDO::getSortOrder, reqVO.getSortOrder())
                .betweenIfPresent(MdlSutraChaptersDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MdlSutraChaptersDO::getId));
    }



}
